﻿Shader "Custom/Cola" {
	Properties {
		_MainTex ("Albedo (RGB)", 2D) = "white" {}
		_T ("Transparent Alpha", 2D) = "white" {}
		_Cola ("Penqi", 2D) = "white" {}
		_ColaRate ("Appear rate", Range(0,1)) = 0.0
		_Alpha ("Alpha", Range(0,1)) = 0.5
	}
	SubShader {
		Tags { "RenderType"="Opaque" }
 		//Tags {"Queue"="Transparent" }
 		//ZWrite Off
 		//Blend SrcAlpha OneMinusSrcAlpha
		LOD 200

		//ZWrite Off
		//Blend SrcAlpha OneMinusSrcAlpha
		
		CGPROGRAM
		// Physically based Standard lighting model, and enable shadows on all light types
		//#pragma surface surf Lambert alpha//test:_Cutoff
		#pragma surface surf Standard fullforwardshadows

		// Use shader model 3.0 target, to get nicer looking lighting
		#pragma target 3.0

		sampler2D _MainTex;
		sampler2D _T;
		sampler2D _Cola;
		float Clip=0;

		struct Input {
			float2 uv_MainTex;
		};

		half _Alpha;
		half _ColaRate;

		void surf (Input IN, inout SurfaceOutputStandard o) {
			// Albedo comes from a texture tinted by color
			//fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
			half4 c = tex2D (_MainTex, float2(_Alpha,_Alpha));
			half4 t = tex2D (_T, IN.uv_MainTex);
			half4 p = tex2D (_Cola, IN.uv_MainTex);
			if(IN.uv_MainTex.x>=_Alpha)// && IN.uv_MainTex.y==_Alpha)
			{
				o.Albedo = c.rgb;
			}
			else
			{
				//clip(-1);
				o.Albedo = half3(0,0,0);
			}
			o.Alpha = 1;
		}
		ENDCG
	}
	FallBack "Diffuse"
}
